// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   rate_change_ok.java

package crm.config.intranalyse;

import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;
import validata.ValidataNumber;

public class rate_change_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;
	nseer_db_backup1 erp_db;

	public rate_change_ok()
	{
		erp_db = null;
	}

	public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			java.io.PrintWriter out = response.getWriter();
			nseer_db_backup1 design_db = new nseer_db_backup1(dbApplication);
			ValidataNumber validata = new ValidataNumber();
			if (design_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String product_ID = request.getParameter("product_ID");
				String product_name = exchange.unURL(request.getParameter("product_name"));
				String order_sale_bonus_rate = request.getParameter("order_sale_bonus_rate");
				String order_profit_bonus_rate = request.getParameter("order_profit_bonus_rate");
				if (validata.validata(order_sale_bonus_rate) && validata.validata(order_profit_bonus_rate))
				{
					String sql2 = (new StringBuilder("update design_file set order_sale_bonus_rate='")).append(order_sale_bonus_rate).append("',order_profit_bonus_rate='").append(order_profit_bonus_rate).append("' where product_ID='").append(product_ID).append("'").toString();
					design_db.executeUpdate(sql2);
					response.sendRedirect("crm/config/intranalyse/rate_change_ok_a.jsp");
				} else
				{
					response.sendRedirect("crm/config/intranalyse/rate_change_ok_b.jsp");
				}
				design_db.commit();
				design_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception exception) { }
	}
}
